/*
 * Copyright (C) 2012  E-dance Studio Harbin Institute of Technology 
 * Project:campusmobile
 * Author: 初楷博
 * Create Date: 2012-5-23上午08:36:22
 */
package hit.edance.campusmobile.chat;



import hit.edance.campusmobile.chat.activity.ActivityLogin;
import hit.edance.campusmobile.chat.service.CampusMobileService;
import hit.edance.campusmobile.chat.util.ConstantUtil;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;

/**
 * 欢迎界面<br/>
 * <p>
 * 初始化程序参数，包括屏幕分辨率，网络连接，应用设置信息等
 * </p>
 * <p>
 * 应用程序意外关闭的恢复处理
 * </p>
 * 
 * @Project campusmobile
 * @Package hit.edance.campusmobile.chat
 * @Class ActivityWelcome
 * @Date 2012-5-23 上午08:34:22
 * @author 初楷博
 * @version 1.0
 * @since 1.0
 */
public class ActivityWelcome extends Activity {

	/** 首先被调用 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.chat_main);
		//启动服务
		startService(new Intent(this,CampusMobileService.class));
		
		getScreenInformation(); // 获取屏幕的宽、高、像素密度
//		//检测是否有可用网络
//		if (NetUtil.isNetworkAvailable(this))
//			Toast.makeText(this, getResources().getString(R.string.toast0),
//					Toast.LENGTH_SHORT).show();
		startActivity(new Intent(ActivityWelcome.this,ActivityLogin.class));
		this.finish();
	}

	/**
	 * 获取屏幕参数，存放在ConstantUtil类中<br/>
	 * widthPixels：宽<br/>
	 * heightPixels：高<br/>
	 * density：像素密度<br/>
	 */
	private void getScreenInformation() {
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(dm);
		ConstantUtil.widthPixels = dm.widthPixels;
		ConstantUtil.heightPixels = dm.heightPixels;
		ConstantUtil.density = dm.density;
	}
}